<?php $url = $this->baseUrl();?>
<?php 
	$storage = new Zend_Auth_Storage_Session();
	$data = $storage->read();
?>
<div class="main-profile">
	<ul>
		<li class="avatar">
			<p>
			<a href="#">
			
			<?php if(isset($data->avatar)):?>
			
				<img alt="noavatar" width="100" height="100" src="<?php echo $url;?>/upload/<?php echo $data->avatar;?>">
				
			<?php else :?>
				<img alt="noavatar" src="<?php echo $url;?>/upload/noavatar.gif">
			<?php endif;?>
			</a>
			</p>
			<form enctype="multipart/form-data" name="uploadavatar" method="POST">		
								
				<label class="filebutton">
							<input type="hidden" name="module" value="uploadavatar">
                            <span><input type="file" id="myfile" name="myfile" onChange="document.forms['uploadavatar'].submit()"></span>
               	</label>
			</form>
		</li>
		
		<li>
			<table class="table">
				<tbody>
				<tr>
					<td><b>Tên đầy đủ</b></td>
					<td>
						<div id="displayname">
							<p><?php echo $data->displayname;?></p>
						</div>
						
						<div id="edit_displayname" style="display: none">
						<form method="post">
							<p><input name="displayname" type="text" placeholder="Tên đầy đủ"></p>
							
							<p>
								<input type="hidden" name="module" value="edit_displayname">
								<button class="btn btn-success">Lưu lại</button>
							</p>
						</form>
						</div>
					
					</td>
					<td><a id="edit" href="javascript:void(0);" onclick = "onshowEdit('displayname','edit_displayname','edit');">Thay đổi</a></td>
				</tr>
				<tr>
					<td><b>Email</b></td>
					<td>
					
					<div id="email">
					
						<p><b><?php echo $data->email;?></b></p>
					
					</div>
					<div id="edit_email" style="display:none;">
						<p><input type="text" placeholder="Email"></p>
							
						<p><button class="btn btn-success">Lưu lại</button></p>					
					</div>
					
					</td>
					<td>
					<!-- <a id="edit1" href="javascript:void(0);" onclick = "onshowEdit('email','edit_email','edit1');">Thay đổi</a> !-->
					</td>
				</tr>
				<tr>
					<td><b>Password</b></td>
					<td>
					<div id="password">
						<p>*******</p>
					</div>
					
					<?php if (isset($this->errorMessage)):?>
					
					<div id="edit_password" style="display:block;">
					
					<?php else :?>
					
					<div id="edit_password" style="display:none;">
					
					<?php endif;?>
					
						<form method="post">					
						<p>
						
							<input type="password" name="passwordold" placeholder="Mật khẩu cũ">
							
							<span style="color: red;"><?php echo $this->errorMessage;?></span>
						
						</p>
						<p><input type="password" name="passwordnew" placeholder="Mật khẩu mới"></p>						
						<p>
							<input type="hidden" name="module" value="edit_password">
							<button class="btn btn-success" type="submit">Lưu lại</button>
						</p>
						</form>
					</div>
					</td>
					<td><a id="edit2" href="javascript:void(0);" onclick = "onshowEdit('password','edit_password','edit2');">Thay đổi</a></td>
				</tr>				
				</tbody>
			</table>
		</li>
	</ul>
</div>
